const App = {
    // mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            photo,
            Data: [],
            fileUrl:'',
            dialog:false,
            dataForm:{},
            assistance:[],
            organization:[]
        }
    },
    mounted() {
        let ls_URL = window.location.href;
        let Assistance_SerialNumber = getQueryObject(ls_URL, "nodeKey");// 获取 nodeKey 参数
        this.handleShow(Assistance_SerialNumber);
        this.getCategory();
    },
    methods: {
        getCategory() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'party_organization',
                    Condition: "Row_Status='0'",
                },
                success: (data) => {
                    this.organization = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'party_members_assistance_type',
                    Condition: "Row_Status='0'",
                },
                success: (data) => {
                    this.type = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
                type: "POST",
                data: {
                    SQLSerialNumber: 'f_party_member_information',
                    Condition: '',
                    ExtensionCondition: '',
                },
                success: (data) => {
                    this.assistance = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        },
        handleShow(Assistance_SerialNumber) {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                method: "post",
                data: {
                    Data: 'party_members_assistance',
                    Condition: `Assistance_SerialNumber='${Assistance_SerialNumber}'`,
                },
                success: (res) => {
                   this.dataForm = res[0]
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest)
                },
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
                method: "post",
                data: {
                    SQLSerialNumber: "t_party_members_assistance_log",
                    Condition: window.btoa(unescape(encodeURIComponent("%"+Assistance_SerialNumber+"%"))),
                },
                success: (res) => {

                    this.Data = res;
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
            });
        },
        handleHF(row){
            window.location.href = "./add2.html?action=Add&nodeKey=" + row.Assistance_Log_SerialNumber;
        },
        handleHFShow(row){
            window.location.href = "./show1.html?action=Add&nodeKey=" + row.Assistance_Log_SerialNumber;
        },
        handlePreview(row){
            this.fileUrl = this.photo + row.Attachment_URL;
            this.dialog = true;
        },
        goBack() {
            window.history.back();
        },
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
app.component('yl-online-preview', ylOnlinePreview)
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus,{locale: zhCn});
app.mount("#app");
